package weekMatch.one_351;

import java.util.ArrayList;
import java.util.List;

public class LeeCode_03 {
    public static void main(String[] args) {

    }
    private static int numberOfGoodSubarraySplits(int[] nums) {
        int n = nums.length;
        long ans = 1;
        long mod = (long) (1e9 + 7);
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            if (nums[i] == 1)
                list.add(i);
        }
        int m = list.size();
        if (list.size() == 0)
            return 0;
        for (int i = 0; i < m - 1; i++) {
            ans *= list.get(i + 1) - list.get(i);
            ans %= mod;
        }
        return (int) ans;
    }
}